Animation Design

Start

Two panes - Left for text, right for plots.

Text : “How are QQ plots constructed?” Right pane - scatterplot of y vs x of some dataset.

Animation 1

  • Projecting of the dataset onto Y axis (We want to check if y is normally dist)

  • X axis Fades away

  • Y axis is black, points are red.

Animation notes:

  • Setting Y = Y, X = 0 for all points and just doing a smooth transition. Then at the end fading the X axis.

Text : “We will begin by checking whether our variable Y - , is normally distributed”

Animation 2

Flipping of the axis (Y should now be our horizontal axis)

Animation notes:

  • Setting Y = X, X = Y, and doing a transition between them.

  • Need to figure out how to transition the axis itself

Text : “That means our goal is to compare the distribution of Y - , to that of a standard normal distribution.”

Animation 2.5

Standardizing Y.

Text “We standardize our data to make it more interpretable throughout calculations. It does not influence the distribution.”

Animation 3

Rise of the histogram for Y. Keeping the datapoints on the Axis still.

Animation notes:

  • Adding geom_hist

  • Keeping datapoints on X axis

  • Maybe add a density estimation as well?

Text : “This is what the distribution of Y looks like.”

Animation 4

Splitting the plot into 2 parts - Adding the Normal Density Plot / Histogram above.

Animation notes:

  • Keep the same plot, just subplot normal density above.

  • Make sure the Normal plot has the same exact binwidth and placement as the one for data. Make it blue vs black for our data.

Text : “And this is what we would see in the ideal scenario”

Animation 5

Adding the third and fourth panel to the right of both. Have empty axis and a straight line ready in bottom one (QQ plot).

Animation notes:

  • Use recursive subplots from plotly

  • Possibly blow up not one but two panels - one for calculations, and one for QQ-plot

Text : “First we need to see what numbers we would expect from our data if it was actually normally distributed”

Animation 7

Flash the datapoints on scatterplot blue and large, then start adding labels. First one from the left gets a 1, second a 2, and so on.

Text : “We begin by assigning ranks to our datapoints to determine quantiles”

Animation 8

Move the points on the scatter plot to the middle of the plot, color them blue then flash “n = #points” in the top right corner and make it appear as that text on the calculations tab as well. Move the points back down to the axis.

Text: “We calculate the number of points we have - n = #points”

Animation 9

Blow up the Calculations pane to be large. Have one single large point on there and space enough for labels. Move the first point there. Show r = rank, and n = #points in top right.

Animation notes:

  • Color the corresponding datapoint on the data graph in red, put a vertical line through the historgram as well maybe? Maybe make it an arrow?

  • Start by flashing the point bigger a few times, moving it to top right corner of the histogram plot. Then have it fade in at the bottom left of the calculation pane, and move to the top left of it.

  • There should be a n = #points already in top right, and when the point arrives have r = 1 pop up.

Text: " We will be using the same function to estimate quantiles as R does in the standard version. There are multiple options here"

Animation 10

Put the formulas for our probability points on the calculations pane:

If \(n \leq 10\) : \[ p_r = \frac{(r-\frac{3}{8})}{n-\frac{1}{4}} \]

If \(n > 10\) :

\[ p_r = \frac{(r-\frac{1}{2})}{n} \]

Plug r = 1 and n = #points into it and show the number.

Text: " We estimate the quantile of our data. This is equivallent to calling the ppoints(x) function on it. This means that we expect $p_1 = $ of data to fall below this point."

Animation 11

Blow up the normal density plot and put a big blue line at the quantile of the distribution. Flash the actual value for that quantile and then make it appear on the right side as $q_1 = $ . Show the calculation of \(p_1 - q_1 = d_1\) (TODO: double check this is the correct sign and direction)

Text: “We obtain a corresponding quantile of the normal distribution. Note that this value is higher / lower than expected.”

Animation 12

Move the datapoint down and fade away, then show up at the QQ plot and move it to it’s position. Label the point on the axes with the same colors as \(p_1\) and \(q_1\) for the axis respectively. Add a short line from it to the QQ-line, and flash it red with the number on the calculations plot also flashing the same color.

Text: “Now we plot the point at it’s position x = \(p_1\), y = \(q_1\)”.

Animation 13

Flash to about the middle of the pack and repeat Animations 10-12 for it.

Text: “We repeat the procedure for the rest of the datapoints”.

Animation 14

Flash to the last point and repear Animations 10-12 for it.

Text: “We repeat the procedure for the rest of the datapoints”.

Animation 15

The QQplot takes over the entire plotting area.

Text: “And we have made a QQplot”

LS0tCnRpdGxlOiAiUVEgcGxvdCBhbmltYXRpb24gZGVzaWduIGRvY3VtZW50IgpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sKLS0tCgojIEFuaW1hdGlvbiBEZXNpZ24KCiMjIFN0YXJ0CgpUd28gcGFuZXMgLSBMZWZ0IGZvciB0ZXh0LCByaWdodCBmb3IgcGxvdHMuCgpUZXh0IDogIkhvdyBhcmUgUVEgcGxvdHMg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